package com.jia.train.seat.request;

import com.jia.train.global.page.PageRequest;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

@Data
public class DailyTrainTicketQueryRequest extends PageRequest implements Serializable {

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date date;

    private String tripCode;

    private String start;

    private String end;

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        DailyTrainTicketQueryRequest that = (DailyTrainTicketQueryRequest) o;
        return Objects.equals(date, that.date) && Objects.equals(tripCode, that.tripCode)
                && Objects.equals(start, that.start) &&
                Objects.equals(end, that.end) && Objects.equals(getPage(), that.getPage())
                && Objects.equals(getSize(), that.getSize())
                ;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), date, tripCode, start, end, getPage(), getSize());
    }
}
